/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mrp.productionPlanning.entity;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;

/**
 *
 * @author xhx
 */
@Entity
public class DailyMPSTableEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
   @Temporal(javax.persistence.TemporalType.DATE)
    private Date day = new Date();
    private int inventory = 0;
    private String productType = null;
    private String monthName = null;
    private String weekName = null;
    private int yearName = 0;
    private int workingDay = 0;
    private int currentDay=0;
    private int productionDemand =0;
    private Timestamp ts = new Timestamp(day.getTime());
    
    @ManyToOne(targetEntity = MonthlyDetailEntity.class, cascade = {CascadeType.PERSIST})
    private MonthlyDetailEntity monthlyDetailEntity = new MonthlyDetailEntity();
    
    @ManyToOne(targetEntity = DailyDetailEntity.class, cascade = {CascadeType.ALL})
    private DailyDetailEntity dailyDetailEntity = new DailyDetailEntity();
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DailyMPSTableEntity)) {
            return false;
        }
        DailyMPSTableEntity other = (DailyMPSTableEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mrp.productionPlanning.entity.DailyMPSTableEntity[ id=" + id + " ]";
    }

    public Date getDay() {
        return day;
    }

    public void setDay(Date day) {
        this.day = day;
    }

    public int getInventory() {
        return inventory;
    }

    public void setInventory(int inventory) {
        this.inventory = inventory;
    }

    public String getProductType() {
        return productType;
    }

    public void setProductType(String productType) {
        this.productType = productType;
    }

    public String getMonthName() {
        return monthName;
    }

    public void setMonthName(String monthName) {
        this.monthName = monthName;
    }

    public int getYearName() {
        return yearName;
    }

    public void setYearName(int yearName) {
        this.yearName = yearName;
    }

    public int getWorkingDay() {
        return workingDay;
    }

    public void setWorkingDay(int workingDay) {
        this.workingDay = workingDay;
    }

    public Timestamp getTs() {
        return ts;
    }

    public void setTs(Timestamp ts) {
        this.ts = ts;
    }

    public String getWeekName() {
        return weekName;
    }

    public void setWeekName(String weekName) {
        this.weekName = weekName;
    }

    public MonthlyDetailEntity getMonthlyDetailEntity() {
        return monthlyDetailEntity;
    }

    public void setMonthlyDetailEntity(MonthlyDetailEntity monthlyDetailEntity) {
        this.monthlyDetailEntity = monthlyDetailEntity;
    }

    public DailyDetailEntity getDailyDetailEntity() {
        return dailyDetailEntity;
    }

    public void setDailyDetailEntity(DailyDetailEntity dailyDetailEntity) {
        this.dailyDetailEntity = dailyDetailEntity;
    }

    public int getCurrentDay() {
        return currentDay;
    }

    public void setCurrentDay(int currentDay) {
        this.currentDay = currentDay;
    }

    public int getProductionDemand() {
        return productionDemand;
    }

    public void setProductionDemand(int productionDemand) {
        this.productionDemand = productionDemand;
    }
    
}
